package pro.spring.controller.backController;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import pro.spring.model.Admin;

@Controller
@RequestMapping("config")
public class ConfigController extends BaseController{
	@ResponseBody
	@RequestMapping(value="vediotoken.html",method=RequestMethod.POST)
	public String vediotoken(String vediotoken){
		//暂时先用id6来表示位置
		Admin admin =adminService.selectByNameForVedio("vediotoken");
		if(admin==null){
			admin= new Admin();
			admin.setaPassword(vediotoken);
			admin.setaName("vediotoken");
			admin.setaRank(0);
			admin.setImgaesImId(0);
			admin.setaAccount("vediotokechuncu");
			if(adminService.insert(admin)==1){
				return "ok";
			}else{
				return "false";
			}
		}else{
			admin.setaPassword(vediotoken);
			if(adminService.updateByPrimaryKey(admin)==1){
				return "ok";
			}else{
				return "false";
			}
		}
	}
}
